<template>
  <div class="stat-data">
    <el-scrollbar>
      <div class="stat-data__innber">
        <DataItem v-for="item in statData" :data="item" />
      </div>
    </el-scrollbar>
  </div>
</template>
<script setup>
import { http } from '@/utils/http'

import DataItem from './DataItem.vue'

const statData = ref([])

let intervalId

const { loading, request } = useRequest(() => {
  clearInterval(intervalId)
  return http.get('/league_rule/league_data_status').then(res => {
    statData.value = res.data.all

    // intervalId = setInterval(() => {
    //   if (!loading.value) request(false)
    // }, 30 * 1000)

  })
})

onMounted(() => {
  // if (localStorage.isDev) return
  // intervalId = setInterval(() => {
  //   if (!loading.value) request(false)
  // }, 30 * 1000)
})

onUnmounted(() => {
  clearInterval(intervalId)
})
</script>
<style lang="scss" scoped>
.stat-data__innber {
  display: flex;
  width: 100%;
  padding-bottom: 12px;
}
</style>
